<template>
<!-- 在线 -->
  <!-- 好友动态  在线部分 -->
  <div class="continer">
    <div class="online_content">
      <!-- 一个人物的描述-->
      <!-- <div class="whole_persons">
        <div
          class="person_person"
          v-for="(item, index) in onlineList"
          :key="index"
        >
          <div
            class="member_you"
            :style="{
              backgroundImage: 'url(' + item.DisplayHeader + ')',
              backgroundRepeat: 'no-repeat',
            }"
          >
            <img src="../assets/online/members.png" />
          </div>
          <div class="peron_intro">
            <div class="">{{ item.MemberName || "ella" }}</div>
            <div class="age_gemini">
              <div class="age_ages">{{ item.Age }}岁</div>
              <div class="constellation">双子座</div>
            </div>
          </div>
        </div>
      </div> -->
      <!-- 人物栏 -->
      <div class="online_content-role">
        <div v-for="(item, index) in onlineList" :key="index">
          <div
            :style="{
              backgroundImage: 'url(' + item.DisplayHeader + ')',
              backgroundRepeat: 'no-repeat',
              backgroundSize: '100%',
              backgroundPosition: 'center',
            }"
            class="img-content"
          >
            <div>
              <img src="../assets/online/members.png" />
            </div>
            <div>
              <div>{{ item.Name || "ella" }}</div>
              <div>
                <div>{{ item.Age }}岁</div>
                <div>双子座</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 分页开始 -->
      <div class="paging_starts">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="total"
          @current-change="change_num"
        >
        </el-pagination>
      </div>
      <!-- 分页结束 -->
    </div>
  </div>
</template>
<script>
import { getIndexOnline } from "../utils/http.js";
export default {
  name: "Online",
  data: () => ({
    onlineList: [],
    pageNum: 1, // 分页
    total: 0,
  }),
  created() {
    this.getIndex();
  },
  methods: {
    getIndex() {
      let param = {
        Page: this.pageNum,
      };
      getIndexOnline(param).then((res) => {
        this.onlineList = res.Obj.List;
        //       this.total 接口需要调整，需要接口单独返回一个参数total
        console.log(res.Obj.List, "209");
      });
    },
    // 分页方法
    change_num(value) {
      this.pageNum = value;
      this.getIndex();
      console.log(value, "value");
    },
  },
};
//好友在线功能
</script>
<style lang="less" scoped>
.continer {
  width: 100%;
  background-color: #ffffff;
}
.online_content {
  margin: 0 auto;

  &-role {
    display: flex;
    flex-wrap: wrap;
    background-size: cover;
    div {
      width: 20%;
      height: 275px;
      margin: 10px 10px;
      border-radius: 20px;
      > div {
        width: 100%;
      }
    }
  }
}
/* 上面的盒子 */
.whole_persons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.person_person {
  width: 8.2rem;
  height: 8.1rem;
  border-radius: 10px;
  /* background: url("../assets/online/visitorAvatar.png") center no-repeat; */
}
.member_you {
  position: relative;
  left: 10%;
  top: 2%;
}
.peron_intro {
  display: flex;
  align-items: center;
  justify-content: space-around;
  /* font-size: 20px; */
  /* font-weight: 500; */
  font-size: 12px;
  font-weight: 500;
  font-family: PingFang SC;
  color: #ffffff;
  position: relative;
  top: 55%;
}
.age_gemini {
  display: flex;
  width: 58%;
  align-items: center;
  justify-content: space-between;
}
.age_ages {
  background: gray;
  border-radius: 6px;
  padding: 0.1rem;
}
.constellation {
  background: gray;
  border-radius: 6px;
  padding: 0.1rem;
}
.paging_starts {
  display: flex;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  position: relative;
  top: 1px;
  width: 55%;
}
.img-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  background-size: cove;
  > div:nth-child(2) {
    display: flex;
    height: 0;
    position: absolute;
    bottom: 30px;
    > div:nth-child(1) {
      margin: 0 0;
      font-family: PingFang SC;
      color: #ffffff;
    }
    > div:nth-child(2) {
      display: flex;
      margin: 0 0;
      > div:nth-child(1) {
        width: 40px;
        margin-right: 5px;
      }
      > div:nth-child(2) {
        width: 80px;
        margin-right: 15px;
      }
      div {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(255, 255, 255, 0.7);
        background-color: rgba(255, 255, 255, 0.2);
        text-align: center;
        border-radius: 6px;
        height: 20px;
        margin: 0 0;
      }
    }
  }
}
</style>


